from django.db import models


# Create your models here.


# 商品表
class Goods(models.Model):
	name = models.CharField(max_length=100)
	price = models.CharField(max_length=100)

	class Meta:
		db_table = 'goods'


# 作者表
class Author(models.Model):
	name = models.CharField(max_length=100)
	age = models.CharField(max_length=100)

	class Meta:
		db_table = 'author'


# 图书表
class Book(models.Model):
	name = models.CharField(max_length=100)
	price = models.DecimalField(max_digits=10, decimal_places=2)
	author = models.ForeignKey(Author, on_delete=models.CASCADE)

	class Meta:
		db_table = 'book'


# 用户表
class User(models.Model):
	username = models.CharField(max_length=255)
	password = models.CharField(max_length=255)

	class Meta:
		db_table = 'user'
